
var name = "john";
var age = 20;

console.log(name + age);

var gavin = new String("gavin");

// 属性
console.log("gavin length: %d", gavin.length);

// 新字符串
console.log(gavin.concat(name));
console.log("after replaced: %s", gavin.replace("a", "d"));
console.log("substring: %s", gavin.substring(1,));

// 访问字符
console.log("chat at 0 position: %s", gavin.charAt(0));
console.log("a index: %s", gavin.indexOf("a"));
console.log(gavin.split(''));
console.log("primitive value of string: %s", gavin.valueOf());